package hu.plajko.client;

import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.DragAppearance;
import com.smartgwt.client.widgets.ImgButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;

public class ExtendLayout extends VLayout {

	private int overlapWidth = 23;
	private int overlapHeight = 23;

	public ExtendLayout() {

		setMemberOverlap(18);
		setDragAppearance(DragAppearance.TARGET);
		
		ImgButton b = new ImgButton();
		b.setLayoutAlign(Alignment.RIGHT);
		b.setSrc("close.png");
		b.setWidth(overlapWidth);
		b.setHeight(overlapHeight);
		
		b.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				markForDestroy();
				
			}
		});
		
		addMember(b);
		
		VLayout content = new VLayout();
		content.setStyleName("margin-right");
		
		content.setEdgeImage("border.png");
		content.setEdgeSize(18);
		content.setShowEdges(true);
		content.setEdgeShowCenter(true);
		content.setCanDragReposition(true);
		content.setCanDragResize(true);
		content.setDragTarget(this);
		addMember(content);
	}

}
